package com.my.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.my.admin.entity.Article;
import com.my.admin.mapper.ArticleMapper;
import com.my.admin.service.ArticleService;
import com.my.admin.util.ServiceImplCache;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl extends ServiceImplCache<ArticleMapper, Article> implements ArticleService {

    @Override
    @Cacheable(value = "getList")
    public IPage<Article> getList(IPage<Article> page, Article article) {
        return baseMapper.getList(page, article);
    }

    @Override
    @Cacheable(value = "apiList")
    public IPage<Article> apiList(IPage<Article> page) {
        return baseMapper.apiList(page);
    }

    @Override
    @Cacheable(value = "apiById")
    public Article apiById(Long id) {
        return baseMapper.apiById(id);
    }

    @Override
    @Cacheable(value = "plusViews")
    public boolean plusViews(Long id) {
        return baseMapper.plusViews(id) > 0;
    }

}
